import { Response, Request, NextFunction } from 'express'
import { getTokenKey } from '../src/typography/kit/cookie'

export const accessTokenAuth = (req: Request, res: Response, next: NextFunction) => {
  const tokenKey = getTokenKey()
  const accessToken = req.header(tokenKey)
  if (!accessToken) {
    return res.status(401).json({
      code: 10001
    })
  }
  next()
}
